home *** CD-ROM | disk | FTP | other *** search
Wrap
Attribute VB_Name = "Module2" Option Explicit ' This file contains Visual Basic declarations for the Sort Solution Library ' Copyright ⌐ 1997,98 Mario M. Westphal ' All Rights reserved ' ' Version 1.4.0 ' ' ############################################################################## ' The error codes returned from the various Sort Solution APIs ' You can use these codes to retrieve appropriate error messages from the ' "SSIGetErrorMessage" API ' ############################################################################## Public Const SOSOERR_SUCCESS = 0 ' Successful execution Public Const SOSOERR_FIRST = 20000 ' First error code Public Const SOSOERR_UNKNOWN = (SOSOERR_FIRST + 1) ' Unknown error ' Source file Public Const SOSOERR_OPENSOURCE = (SOSOERR_FIRST + 2) ' Error opening the source file Public Const SOSOERR_READSOURCE = (SOSOERR_FIRST + 3) ' Error reading from the source file Public Const SOSOERR_SEEKSOURCE = (SOSOERR_FIRST + 4) ' Error seeking in the source file Public Const SOSOERR_CLOSESOURCE = (SOSOERR_FIRST + 5) ' Error closing the source Public Const SOSOERR_PARSESOURCE = (SOSOERR_FIRST + 6) ' Error while parsing the structure of the source file Public Const SOSOERR_INVALIDFORMAT = (SOSOERR_FIRST + 7) ' Invalid file format Public Const SOSOERR_RUNTIME = (SOSOERR_FIRST + 8) ' Runtime error Public Const SOSOERR_MEMORY = (SOSOERR_FIRST + 9) ' Invalid file format Public Const SOSOERR_EXPLICITOFFSET = (SOSOERR_FIRST + 10) ' Offset wrong Public Const SOSOERR_EXPLICITLEN = (SOSOERR_FIRST + 11) ' Len to > 5 Public Const SOSOERR_EXPLICITRECLEN = (SOSOERR_FIRST + 12) ' Record to short Public Const SOSOERR_ABORTED = (SOSOERR_FIRST + 18) ' User abort Public Const SOSOERR_NORECORDS = (SOSOERR_FIRST + 19) ' No records found in input file Public Const SOSOERR_OPENDEST = (SOSOERR_FIRST + 20) ' Error opening the destination file Public Const SOSOERR_WRITEDEST = (SOSOERR_FIRST + 21) ' Error writing to the destination file Public Const SOSOERR_SEEKDEST = (SOSOERR_FIRST + 22) ' Error seeking in the destination file Public Const SOSOERR_CLOSEDEST = (SOSOERR_FIRST + 23) ' Error closing the destination file Public Const SOSOERR_DESTNOSPACE = (SOSOERR_FIRST + 24) ' Not enough space on the destination drive Public Const SOSOERR_OPENMERGE = (SOSOERR_FIRST + 30) ' Error opening a merge file Public Const SOSOERR_READMERGE = (SOSOERR_FIRST + 31) ' Error reading from a merge file Public Const SOSOERR_WRITEMERGE = (SOSOERR_FIRST + 32) ' Error writing to a merge file Public Const SOSOERR_SEEKMERGE = (SOSOERR_FIRST + 33) ' Error seeking in a merge file Public Const SOSOERR_CLOSEMERGE = (SOSOERR_FIRST + 34) ' Error closing a merge file Public Const SOSOERR_GETMERGEFILENAME = (SOSOERR_FIRST + 35) ' Error retrieving a merge file name Public Const SOSOERR_NOMERGESPACE = (SOSOERR_FIRST + 36) ' All merge drives are full Public Const SOSOERR_NOMERGEDRIVESAVAIL = (SOSOERR_FIRST + 37) ' No merge drives are available Public Const SOSOERR_CHECK_SOURCENOTFOUND = (SOSOERR_FIRST + 100) ' Source file not found Public Const SOSOERR_CHECK_CREATEDEST = (SOSOERR_FIRST + 101) ' Error creating the destination file Public Const SOSOERR_CHECK_INVALIDMERGEDRIVE = (SOSOERR_FIRST + 102) ' Invalid merge drive specified Public Const SOSOERR_OPENLOG = (SOSOERR_FIRST + 120) ' Error opening the logfile Public Const SOSOERR_WRITELOG = (SOSOERR_FIRST + 121) ' Error writing the logfile Public Const SOSOERR_NOKEYSDEFINED = (SOSOERR_FIRST + 200) ' No keys defined Public Const SOSOERR_ERRORCREATEINSTANCE = (SOSOERR_FIRST + 201) ' Error creating a sort instance Public Const SOSOERR_ERRORINVALIDERRORCODE = (SOSOERR_FIRST + 202) ' Invalid error code for SSIGetErrorMessage Public Const SOSOERR_KEYDLL_NOTFOUND = (SOSOERR_FIRST + 300) ' User DLL was not found Public Const SOSOERR_KEYDLL_COMPARE_NOTFOUND = (SOSOERR_FIRST + 301) ' The specified compare function could not be found in the DLL Public Const SOSOERR_KEYDLL_NO_NAME = (SOSOERR_FIRST + 302) ' The key definition does not contain a valid DLL name Public Const SOSOERR_KEYDLL_NO_COMPARENAME = (SOSOERR_FIRST + 303) ' The key definition does not contain a valid compare function name Public Const SOSOERR_INVALIDMEMORYORPOINTER = (SOSOERR_FIRST + 999) ' Invalid memory pointer given to one of the API's ' Invalid parameters Public Const SOSOERR_PARAM_INVALIDHANDLE = (SOSOERR_FIRST + 1000) ' Invalid handle given Public Const SOSOERR_PARAM_INVALIDPARAM = (SOSOERR_FIRST + 1001) ' Invalid parameter Public Const SOSOERR_PARAM_INPUTFILENAME = (SOSOERR_FIRST + 1002) ' Invalid source filename Public Const SOSOERR_PARAM_OUTPUTFILENAME = (SOSOERR_FIRST + 1003) ' Invalid destination file name Public Const SOSOERR_PARAM_MERGEDRIVES = (SOSOERR_FIRST + 1004) ' Invalid merge drive specification Public Const SOSOERR_PARAM_FILETYPE = (SOSOERR_FIRST + 1005) ' Unknown file type Public Const SOSOERR_PARAM_RECLEN = (SOSOERR_FIRST + 1006) ' Invalid reclen Public Const SOSOERR_PARAM_DELIMETERS = (SOSOERR_FIRST + 1007) ' Invalid delimeter specification Public Const SOSOERR_PARAM_FIELDS = (SOSOERR_FIRST + 1008) ' Fields argument required in key specification Public Const SOSOERR_PARAM_EXPLICITLEN = (SOSOERR_FIRST + 1009) ' Error in SORTSOL_FTYPE_EXPLICIT filetype Public Const SOSOERR_PARAM_INVALIDKEYTYPE = (SOSOERR_FIRST + 1010) ' Unknown key type Public Const SOSOERR_PARAM_DATEADJUST = (SOSOERR_FIRST + 1011) ' Error in date adjust specifier Public Const SOSOERR_PARAM_KEYPOS = (SOSOERR_FIRST + 1012) ' Invalid key position Public Const SOSOERR_PARAM_KEYOFFSET = (SOSOERR_FIRST + 1013) ' Invalid key offset Public Const SOSOERR_PARAM_WRONGFORMAT_FOR_KEYTYPE = (SOSOERR_FIRST + 1014) ' Wrong file format for key type Public Const SOSOERR_PARAM_HEADERSIZE = (SOSOERR_FIRST + 1015) ' Invalid header size Public Const SOSOERR_PARAM_FILESIZEMISMATCH = (SOSOERR_FIRST + 1016) ' File site must match record length = (SORTSOL_FTYPE_FIXED) Public Const SOSOERR_PARAM_TOMANYKEYS = (SOSOERR_FIRST + 1017) ' To many keys specified Public Const SOSOERR_PARAM_INVALIDMASK = (SOSOERR_FIRST + 1018) ' Invalid date/time mask Public Const SOSOERR_PARAM_INVALIDSEQUENCE = (SOSOERR_FIRST + 1019) ' Invalid sequence Public Const SOSOERR_PARAM_INVALIDKEYLEN = (SOSOERR_FIRST + 1020) ' Invalid key len Public Const SOSOERR_PARAM_DRIVESPACE = (SOSOERR_FIRST + 1021) ' Error in CheckDriveSpace statement Public Const SOSOERR_VERSIONINFO = (SOSOERR_FIRST + 1030) ' Error retrieving the version information ' Command file related errors = (CreateFromFile= () API) Public Const SOSOERR_CMDFILENOTFOUND = (SOSOERR_FIRST + 2000) ' Command file not found Public Const SOSOERR_INVALIDCMDFILENAME = (SOSOERR_FIRST + 2001) ' Invalid command file name Public Const SOSOERR_OPENCMDFILE = (SOSOERR_FIRST + 2002) ' Error opening the command file Public Const SOSOERR_UNKNOWNKEYWORD = (SOSOERR_FIRST + 2003) ' Unknown keyword found Public Const SOSOERR_MISSINGOP = (SOSOERR_FIRST + 2004) ' Missing "= (" Public Const SOSOERR_MISSINGCP = (SOSOERR_FIRST + 2005) ' Missing ")" Public Const SOSOERR_NODRIVES = (SOSOERR_FIRST + 2006) ' Argument missing in DRIVES statement Public Const SOSOERR_INVALIDDRIVES = (SOSOERR_FIRST + 2007) ' Invalid DRIVES statement Public Const SOSOERR_DRIVESPARE = (SOSOERR_FIRST + 2008) ' Invalid DRIVESPARE statement Public Const SOSOERR_THREADS = (SOSOERR_FIRST + 2009) ' Invalid THREADS statement Public Const SOSOERR_CACHES = (SOSOERR_FIRST + 2010) ' Invalid CACHES statement Public Const SOSOERR_SORTMEM = (SOSOERR_FIRST + 2011) ' Invalid SORTMEM statement Public Const SOSOERR_MERGEMEM = (SOSOERR_FIRST + 2012) ' Invalid MERGEMEM statement Public Const SOSOERR_RANGE = (SOSOERR_FIRST + 2013) ' Invalid RANGE statement Public Const SOSOERR_FILTER_ARGS = (SOSOERR_FIRST + 2014) ' Invalid arguments in FILTER statement Public Const SOSOERR_FILTER_TYPE = (SOSOERR_FIRST + 2015) ' Invalid type in FILTER Public Const SOSOERR_FILTER_FTREMOVE_ARGS = (SOSOERR_FIRST + 2016) ' Invalid remove sepcifier in FILTER statement Public Const SOSOERR_INPUTFILE = (SOSOERR_FIRST + 2017) ' Invalid INPUTFILE statement Public Const SOSOERR_INPUTFILEDELETE = (SOSOERR_FIRST + 2018) ' Invalid delete specifier for INPUTFILE statement Public Const SOSOERR_OUTPUTFILE = (SOSOERR_FIRST + 2019) ' Invalid OUTPUTFILE statement Public Const SOSOERR_LOGFILE = (SOSOERR_FIRST + 2020) ' Invalid LOGFILE statement Public Const SOSOERR_COMPRESS = (SOSOERR_FIRST + 2021) ' Invalid COMPRESS statement Public Const SOSOERR_HEADER = (SOSOERR_FIRST + 2022) ' Invalid HEADER statement Public Const SOSOERR_HEADERLEN = (SOSOERR_FIRST + 2023) ' Invalid "length" specifier in HEADER Public Const SOSOERR_HEADER_INBYTES = (SOSOERR_FIRST + 2024) ' Invalid "in bytes" specifier in HEADER Public Const SOSOERR_HEADER_KEEP = (SOSOERR_FIRST + 2025) ' Invalid "keep" specifier in HEADER Public Const SOSOERR_FILETYPE_ARGS = (SOSOERR_FIRST + 2026) ' Invalid arguments for FILETYPE Public Const SOSOERR_FILETYPE_UNKNOWN = (SOSOERR_FIRST + 2027) ' Unknown FILETYPE Public Const SOSOERR_FILETYPE_INVALIDRECLEN = (SOSOERR_FIRST + 2028) ' Invalid record length specifier in FILETYPE Public Const SOSOERR_FILETYPE_SEPARATOR = (SOSOERR_FIRST + 2029) ' Invalid separator Public Const SOSOERR_FILETYPE_DELIMETER = (SOSOERR_FIRST + 2030) ' Invalid delimeter Public Const SOSOERR_FILETYPE_TOMANYFIELDS = (SOSOERR_FIRST + 2031) ' SORTSOL_FTYPE_EXPLICIT: To many fields specified Public Const SOSOERR_FILETYPE_EXINVALIDOFS = (SOSOERR_FIRST + 2032) ' SORTSOL_FTYPE_EXPLICIT: Invalid offset Public Const SOSOERR_FILETYPE_EXINVALIDLEN = (SOSOERR_FIRST + 2033) ' SORTSOL_FTYPE_EXPLICIT: Invalid length Public Const SOSOERR_FILETYPE_EXINVALIDBINSPEC = (SOSOERR_FIRST + 2034) ' SORTSOL_FTYPE_EXPLICIT) Invalid "binary" specifier Public Const SOSOERR_KEY_ARGS = (SOSOERR_FIRST + 2035) ' Invalid arguments found in KEY Public Const SOSOERR_KEY_INVALIDTYPE = (SOSOERR_FIRST + 2036) ' Invalid KEY type Public Const SOSOERR_KEY_INVALIDSORTORDER = (SOSOERR_FIRST + 2037) ' Unknown "sort order" specifier Public Const SOSOERR_KEY_INVALIDPOS = (SOSOERR_FIRST + 2038) ' Invalid "position" specifier Public Const SOSOERR_KEY_INVALIDOFS = (SOSOERR_FIRST + 2039) ' Invalid "offset" specifier Public Const SOSOERR_KEY_INVALIDLEN = (SOSOERR_FIRST + 2040) ' Invalid "length" specifier Public Const SOSOERR_KEY_INVALIDDECPL = (SOSOERR_FIRST + 2041) ' Invalid "decimal places" specifier Public Const SOSOERR_KEY_MASKTOLONG = (SOSOERR_FIRST + 2042) ' Date/time mask too long Public Const SOSOERR_KEY_MASKTOSHORT = (SOSOERR_FIRST + 2043) ' Date/time mask too shoort Public Const SOSOERR_KEY_SEQUENCETOSHORT = (SOSOERR_FIRST + 2044) ' Sequence less than 256 byte Public Const SOSOERR_KEY_PRIMLANG = (SOSOERR_FIRST + 2045) ' Unknown primary language Public Const SOSOERR_KEY_SUBLANG = (SOSOERR_FIRST + 2046) ' Unknown sub-language Public Const SOSOERR_KEY_DATEADJUST = (SOSOERR_FIRST + 2047) ' Invalid "date adjust" specifier Public Const SOSOERR_PRIORITY = (SOSOERR_FIRST + 2048) ' Invalid priority Public Const SOSOERR_OUTPUTFILEAPPEND = (SOSOERR_FIRST + 2049) ' TRUE to append to an existing output file Public Const SOSOERR_KEYDLL_DATAOUTOFRANGE = (SOSOERR_FIRST + 2050) ' "Data" to long in User key Public Const SOSOERR_PARAM_TRAILER_WRONGTYPE = (SOSOERR_FIRST + 2070)' Wrong type in TRAILER statement Public Const SOSOERR_PARAM_TRAILER_KEEP = (SOSOERR_FIRST + 2071) ' Invalid "keep" specifier in TRAILER Public Const SOSOERR_PARAM_TRAILER_EXPR_TOO_LONG = (SOSOERR_FIRST + 2072)' Expression in TRAILER exceeds SOSOMAX_TRAILEREXPR_LEN Public Const SOSOERR_PARAM_TRAILER_LEN = (SOSOERR_FIRST + 2073) ' Length in TRAILER invalid Public Const SOSOERR_TRAILER_LEN = (SOSOERR_FIRST + 2080) ' TRAILER size bigger than input file size Public Const SOSOERR_TRAILER_SAVETEMP = (SOSOERR_FIRST + 2081) ' Error while saving the TRAILER to a temporary file Public Const SOSOERR_TRAILER_READTEMP = (SOSOERR_FIRST + 2082) ' Error while reading the TRAILER from a temporary file ' ############################################################################## ' Types and Structures ' ############################################################################## ' The command state structure is used to transfer information ' to and from the Sort Solution Library Public Type SORTSOL_CMDFILESTATUS Size As Long LineNo As Long ErrLine As String * 256 Override As Long InputFileName As String * 260 DeleteInput As Long OutputFileName As String * 260 AppendOutput As Long LogFileName As String * 260 AppendLog As Long PriorityClass As Long End Type ' These values are returned in the "PriorityClass" member ' of the SSICmdState structure Public Const SOSO_NORMAL_PRIORITY_CLASS = 32 Public Const SOSO_IDLE_PRIORITY_CLASS = 64 Public Const SOSO_HIGH_PRIORITY_CLASS = 128 ' This structure takes informtion about the sort and is used ' in conjunction with "SSIGetStats" Public Type SORTSOL_STATS Size As Long BytesSortedLo As Long BytesSortedHi As Long SortTime As Long MergeTime As Long AvgBlockLoadTime As Long AvgBlockSortTime As Long AvgBlockMergeTime As Long RecordsProcessedLo As Long RecordsProcessedHi As Long RecordsFilteredLo As Long RecordsFilteredHi As Long NumberOfRuns As Long CachePerRun As Long End Type ' ############################################################################## ' Exported APIs ' ############################################################################## Public Declare Function SSICreateFromFile Lib "sortsol.dll" (ByRef handle As Long, ByVal Filename As String, ByRef cmdstate As SORTSOL_CMDFILESTATUS) As Long Public Declare Function SSICreateFromCommandString Lib "sortsol.dll" (ByRef handle As Long, ByVal command As String, ByRef cmdstate As SORTSOL_CMDFILESTATUS) As Long Public Declare Function SSISort Lib "sortsol.dll" (ByVal handle As Long) As Long Public Declare Function SSIFree Lib "sortsol.dll" (ByVal handle As Long) As Long Public Declare Function SSIGetStats Lib "sortsol.dll" (ByVal handle As Long, ByRef stats As SORTSOL_STATS) As Long Public Declare Function SSIGetErrorMessage Lib "sortsol.dll" (ByVal ErrorCode As Long, ByVal Text As String, ByRef Size As Long) As Long Public Declare Function SSIGetVersion Lib "sortsol.dll" (ByRef MS As Long, ByRef LS As Long) As Long ' ############################################################################## ' The callback API (VB 5.x only) ' ############################################################################## ' -------------------------------------------------------------------------------- ' The callback procedure (VB 5.x only) ' Use a callback function like this in your application: ' ' Public Function MySortCallback(ByVal Code As Long, ByVal StatusData As Long, ByVal Extra As Long) As Long ' ' and use this function as an argument to "SSIRegisterCallback": ' ' Dim result As Long ' result = SSIRegisterCallback(handle, AddressOf MySortCallback, 0) ' ' Please note: If you want to update user interface elements, e.g. progress ' bars, don't forget to include a DoEvent call in your callback ' function ' ' Please see the documentation for callbacks in VB Books Online for more information ' regarding callbacks in Visual Basic Public Declare Function SSIRegisterCallback Lib "sortsol.dll" (ByVal handle As Long, ByVal Callback As Long, ByVal Extra As Long) As Long ' These codes are returned in the argument "StatusData" to the callback ' function in your application Public Const SORTSOL_NOTIFY_SORTPERCENTAGE = 1 ' The sort percentage is updated Public Const SORTSOL_NOTIFY_MERGEPERCENTAGE = 2 ' The merge percentage is updated Public Const SORTSOL_NOTIFY_BEGINSORT = 3 ' The sort begins Public Const SORTSOL_STATUS_ONEPHASESORT = 1 ' In-memory sort Public Const SORTSOL_STATUS_MERGESORT = 2 ' Mergesort Public Const SORTSOL_NOTIFY_FINISHSORT = 4 ' The sort is finished Public Const SORTSOL_NOTIFY_BEGINMERGE = 5 ' The merge begins Public Const SORTSOL_NOTIFY_FINISHMERGE = 6 ' The merge is finished Public Const SORTSOL_NOTIFY_FINISHED = 20 ' The complete sort is finished